//
//  HMUser.swift
//  WymanWeibo
//
//  Created by wyman on 16/4/14.
//  Copyright © 2016年 wyman. All rights reserved.
//

import UIKit

class HMUser: NSObject {

    var id: Int64 = 0
    
    //用户昵称
    var screen_name: String?
    
    
    //用户头像地址
    var profile_image_url: String?
    
//    var verified_type:Int = -1 {
  
    //认证,企业认证
    
    var verifiedView: UIImage?

    var verified_type: Int = -1 {
        didSet {
    
            switch verified_type {
            case 0:
                verifiedView = UIImage(named: "avatar_vip")
            case 2,3,5:
               verifiedView = UIImage(named: "avatar_enterprise_vip")
            case 220:
               verifiedView = UIImage(named: "avatar_grassroot")
                
                
            default:
               verifiedView = nil
        
        }
    }
    }
//    if let mbrank = status?.user?.mbrank{
//     
//    }
    
    //认证类型
//    if let verified_type = status?.user?.verified_type{
//        
//        switch verified_type {
//        case 0:
//            verifiedView.image = UIImage(named: "avatar_vip")
//        case 2,3,5:
//            verifiedView.image = UIImage(named: "avatar_enterprise_vip")
//        case 220:
//            verifiedView.image = UIImage(named: "avatar_grassroot")
//            
//            
//        default:
//            verifiedView.image = nil
//            
//        }
//        
//        
//    }
    //verifield图片 别人直接使用这张图片
        var mbrankImage: UIImage?
  
    //会员等级
    var mbrank: Int = 0 {
        didSet{
        if mbrank > 0 && mbrank <= 6 {
        //设置会员图片
        mbrankImage = UIImage(named: "common_icon_membership_level\(mbrank)")
        }else{
        
        mbrankImage = nil
        }
        
        
        }
}

    //会员等级图片,别人直接使用这张图片
    
    //字典转模型
    
    init(dict: [String: AnyObject]) {
        super.init()
        
        //字典转模型
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    //打印字典的模
    
    override var description: String{
        get{
        let keys = ["id","screen_name","profile_image_url","verified_type","mbrank"]
        
            return "\n\t\t: 用户模型: \(dictionaryWithValuesForKeys(keys))"
        }
    }
    
    
    
    
}






